var express = require('express');
var router = express.Router();
var connection = require('../connect');
/* GET home page. */

// 首页轮播图接口
router.get('/banner', (req, res, next) => {
  connection.query('select * from qn_banner', (err, r) => {
    if (err) {
      return next(err);
    }
    console.log(r);
    res.send({
      code: 200,
      msg: '成功',
      data: r,
    });
  });
});
//
router.get('/downa', (req, res, next) => {
  connection.query('select * from qn_dibiaoqian', (err, r) => {
    if (err) {
      return next(err);
    }
    console.log(r);
    res.send({
      code: 200,
      msg: '成功',
      data: r,
    });
  });
});
// 首页加盟列表接口
router.get('/join', (req, res, next) => {
  connection.query('select * from qn_jiameng', (err, r) => {
    if (err) {
      return next(err);
    }
    console.log(r);
    res.send({
      code: 200,
      msg: '成功',
      data: r,
    });
  });
});
// 首页查看活动接口
router.get("/activity", (req, res, next) => {
  connection.query("select * from qn_zuixinhuodong", (err, r) => {
    if (err) {
      return next(err);
    }
    console.log(r);
    res.send({
      code: 200,
      msg: "成功",
      data: r,
    });
  });
});

// 首页关于我们接口
router.get("/understand", (req, res, next) => {
  connection.query("select * from qn_guanyuwomen", (err, r) => {
    if (err) {
      return next(err);
    }
    console.log(r);
    res.send({
      code: 200,
      msg: "成功",
      data: r,
    });
  });
});
module.exports = router;
